﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

public partial class DetailCompany : System.Web.UI.Page
{
    security baomat = new security();
    public string companyName = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Page.RouteData.GetRequiredString("Doanhnghiep_ID") != null)
            {
                companyName = Page.RouteData.GetRequiredString("Doanhnghiep_ID");
                Session["Doanhnghiep_ID"] = companyName;
                using (Up1VNDataContext dc = new Up1VNDataContext())
                {
                    StringBuilder sb = new StringBuilder();
                    var query = dc.EStores.Single(o => baomat.RemoveSpecialCharacter(o.EStore_Name.Replace(" ", "-").ToLower()).Equals(companyName));
                    sb.Append("<iframe id='web-iframe' width='100%' scrolling='auto' frameborder='0' src='http://"+query.EStore_Website.Replace("http","").Replace(":","").Replace("//","")+"' height='700'></iframe>");
                    ltrIframe.Text = sb.ToString();                    
                }
            }
            else
            {
                Response.Redirect(Request.UrlReferrer.PathAndQuery.ToString());
            }
        }
        catch (Exception)
        {
        }
    }
}